#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
  struct TreeNode {
      int val;
      struct TreeNode *left;
      struct TreeNode *right;
 };
int maxDepth(struct TreeNode* root)
{
    if (root == NULL)
        return 0;
    int leftdepth = maxDepth(root->left);
    int rightdepth = maxDepth(root->right);

    if (leftdepth > rightdepth)
    {
        return leftdepth + 1;
    }
    else
    {
        return rightdepth + 1;
    }
}